package demo.bocweb.com.sdk.util;

import android.app.Activity;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.launcher.ARouter;

/**
 * Created by zhelun on 2018/2/2.
 */

public class ARoutUtil {
    Postcard postcard;

    public static ARoutUtil newInstance() {
        return new ARoutUtil();
    }

    public static void startAct(String path) {
        ARouter.getInstance().build(path).navigation();
    }

    public static void startAct(String path, Activity activity, int requestCode) {
        ARouter.getInstance().build(path).navigation(activity, requestCode);
    }


    public ARoutUtil build(String path) {
        postcard = ARouter.getInstance().build(path);
        return this;
    }

    public void startAct() {
        if (postcard != null) {
            postcard.navigation();
        }
    }

    public void startAct(Activity activity, int requestCode) {
        if (postcard != null) {
            postcard.navigation(activity, requestCode);
        }
    }
}
